package com.ay.test;

import java.util.Observable;
import java.util.Observer;

/**
 * @Author: ay
 * @Date: 2021/3/5
 * @Description:
 **/
public class RealObserver2 implements Observer {

    @Override
    public void update(Observable o, Object arg) {
        ConcreteSubject subject = (ConcreteSubject) arg;
        switch (subject.getNum()){
            case 10 :
                System.out.println("RealObserver2 做出反应:" + subject.getNum() + "bu高兴");
                break;
            case 20 :
                System.out.println("RealObserver2 做出反应:" + subject.getNum() + "gao兴");
                break;
            default:
                System.out.println("nothing");
        }
    }
}
